﻿using System;
using System.Linq;

using SharedGenomics.Core;
using SharedGenomics.Domain;

namespace SharedGenomics.Workbench.Annotations
{
    public class SnpAnnotationRepositoryFactory
    {
        private readonly IAnnotationManager _annotationManager;

        public SnpAnnotationRepositoryFactory(IAnnotationManager annotationManager)
        {
            this._annotationManager = annotationManager;
        }

        public virtual SnpAnnotationRepository CreateFor(IAnalysisResultSet results)
        {
            results.ThrowIfNull("results");
            return new SnpAnnotationRepository(results.OfType<AnalysisResult>(), this._annotationManager.ActiveAnnotationDescriptors);
        }
    }
}
